#!/usr/bin/env ruby
# Job yaml can send below ENVIRONMENT VARIABLES to me
# - bad_job_id
# - error_id
# END ENVIRONMENT VARIABLES

# SPDX-License-Identifier: MulanPSL-2.0+
# frozen_string_literal: true

require_relative "#{ENV['CCI_SRC']}/lib/git_bisect"
require_relative "#{ENV['CCI_SRC']}/lib/mail_bisect_result"

task = {'bad_job_id' => ENV['bad_job_id'], 'error_id' => ENV['error_id']}
gb = GitBisect.new(task)
result = gb.find_first_bad_commit

mbr = MailBisectResult.new(result)
mbr.create_send_email
